package cn.iocoder.yudao.module.shop.dal.mysql.agent;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.agent.AgentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.agent.vo.*;

/**
 * 店铺代理商 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface AgentMapper extends BaseMapperX<AgentDO> {

    default PageResult<AgentDO> selectPage(AgentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AgentDO>()
                .eqIfPresent(AgentDO::getLogo, reqVO.getLogo())
                .likeIfPresent(AgentDO::getName, reqVO.getName())
                .eqIfPresent(AgentDO::getTelephone, reqVO.getTelephone())
                .betweenIfPresent(AgentDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(AgentDO::getEndDate, reqVO.getEndDate())
                .betweenIfPresent(AgentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AgentDO::getId));
    }

}